﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RegisterationCommon.Common;
using System.Data;

namespace RegisterationCommon.NoticeParents
{
   public class NoticeParents
    {
        #region Model
        private int _id;
        private string _title;
        private string _content;
        private int _schid;
        private int _status = 0;
        private DateTime _rtime;
       private int _recrive;
        /// <summary>
        /// 
        /// </summary>
        public int ID
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Title
        {
            set { _title = value; }
            get { return _title; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Content
        {
            set { _content = value; }
            get { return _content; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int SchId
        {
            set { _schid = value; }
            get { return _schid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Status
        {
            set { _status = value; }
            get { return _status; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime RTime
        {
            set { _rtime = value; }
            get { return _rtime; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Recrive
        {
            set { _recrive = value; }
            get { return _recrive; }
        }
        #endregion Model
        #region 方法列表
        public int AddNoticePt()
        {
            RParams RP = new RParams();
            RP.Add("Title", this._title, SqlDbType.NVarChar);
            RP.Add("Content", this._content, SqlDbType.NText);
            RP.Add("SchId", this._schid, SqlDbType.Int);
            RP.Add("Status", this._status, SqlDbType.Int);
            RP.Add("Recrive", this._recrive, SqlDbType.Int);
            RP.Add("RTime", this._rtime, SqlDbType.DateTime);
            return AddNotice(RP);
        }
        public int AddNotice(RParams RP)
        {
            return DBAction.Insertselect(ETableName.NoticeParents, RP);
        }
        #endregion

        #region 根据ID查询公告信息
        /// <summary>
        /// 根据ID查询公告信息
        /// </summary>
        /// <param name="leaveID">公告信息编号</param>
        /// <returns>查询成功返回true,否则返回false</returns>
        public bool GetHelpSubjectByID(int noticeID)
        {
            DataTable dt = DBAction.GetDTFromSQL("Select * From " + ETableName.NoticeParents + " where id=" + noticeID);
            if (dt.Rows.Count < 1)
            {
                return false;
            }
            this._id = noticeID;
            this._title = Convert.ToString(dt.Rows[0]["Title"]);
            this._content = Convert.ToString(dt.Rows[0]["Content"]);
            this._recrive = Convert.ToInt32(dt.Rows[0]["Recrive"]);
            this._status = Convert.ToInt32(dt.Rows[0]["Status"]);
            this._rtime = Convert.ToDateTime(dt.Rows[0]["RTime"]);
            return true;
        }
        #endregion

    }
}
